<?php 


	
	
class LoginForm
{
	/**
	 * $errorMessage string
	 * $lastUsername string
	 * 
	 * @return string, loginForm.
	 */
	public function GetForm($errorMessage, $lastUsername)
	{		
		return 
		'<div id="loginForm">
			<h2>Ej inloggad </h2>
			  
			<form action="?login"  method="post" id="form1"  >
				<fieldset>
					<legend> Skriv in ditt användarnamn och lösenord! </legend>
					<p>' . $errorMessage . '</p>
					<label for="usernameInput"> Användarnamn:  </label>
					<input id="usernameInput" type="text" name="username" 
				  		value="' . $lastUsername .'" /> 
					
					<label for="userPassInput"> Password: </label>
					<input id="userPassInput" type="text" name="userpassword" value="" /> 
					<label>Håll mig inloggad:
						<input type="checkbox" name="RememberMe" value="RememberMe"/>
					</label>	
					<input type="submit" name="Submit" value="Logga in" />
				</fieldset>
			</form>
		 </div>';
	}	

	/**
	 * @return Session - username
	 */
	public function GetUsername()
	{
		if(!empty($_POST['username']))
		{
			return $_POST['username'];
		}
		else {
			return;
		}
	}
	
	/**
	 * @return Session - userpassword
	 */
	public function GetUserPassword()
	{
		if(!empty($_POST['userpassword']))
		{
			return $_POST['userpassword'];
		}
		else 
		{
			return;
		}
	}
	
	/**
	 * @Return boolean. True if the user wants us to 
	 * remember them.
	 */
	public function RememberMe()
	{
		if(isset($_POST['RememberMe']))
		{
			if($_POST['RememberMe'] == "RememberMe")
			{
				return true;
			}	
		}
		return false;
	}
	
}

